<template>
  <div class="box">
    <div class="titleBox">
      <span>购物车</span>
      <span>删除</span>
    </div>

    <!-- 商品 -->
    <shang-pin v-for="item in list" :key="item.id" :item="item"></shang-pin>
    <br /><br />
    <div class="goumai">
      <!-- <van-goods-action> -->
        <div class="btns">
          <label for="aaa" @click="qvanx">
            <span name="aaa" >全选</span>
            <input type="checkbox" :checked="c" >
          </label>
        </div>
        <van-goods-action-icon icon="cart-o" text="购物车" badge="5" />
        <div class="jies">结算（{{$store.state.sum2}}）</div>
      <!-- </van-goods-action> -->
    </div>
  </div>
</template>

<script>
import ShangPin from "./components/ShangPin.vue";
export default {
  name: "ShoopPing",
  components: { ShangPin },
  data() {
    return {
      list: [],
      c:false
    };
  },
  methods:{
    qvanx(){
      this.c = !this.c;
      console.log(this.c);
      this.$store.dispatch("ccc",this.c)
    }
  },
  mounted() {
    this.list = this.$store.state.list;
    console.log(this.$store.state.list);
  },
};
</script>

<style scoped lang="scss">
.goumai{
    width: 100%;
    display: flex;
    position: fixed;
    bottom: .8rem;
    align-items: center;
    height:1rem;
    background: white;
    justify-content: space-around;
    font-size: .26rem;
    .btns{
      width: 1rem;
      display: flex;
      justify-content: space-around;
    }
    .jies{
      width: 50%;
      font-size: .3rem;
      background: #FB4B30;
      height: .7rem;
      line-height: .7rem;
      text-align: center;
      border-radius: .5rem;
      color: white;
    }
}
.box {
  background: #f4f4f4;
  width: 100%;
  height: 100vh;
}
.titleBox {
  width: 100%;
  height: 0.8rem;
  line-height: 0.8rem;
  background: white;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 0;
  left: 0;
  span:nth-child(1) {
    font-size: 0.4rem;
  }
  span:nth-child(2) {
    font-size: 0.3rem;
    color: #48cf66;
    position: absolute;
    right: 0;
  }
}
</style>